how to use tuic with docker-compose on centos7

  1. prepare configuration files

    mkdir -p /etc/tuic/ # we can generate token with pwgen
    cat << EOF > /etc/tuic/config.json
    {
        "port": 443,
        "token": ["Chie3phuguzaekemuquutahmeiBaig8a"],
        "certificate": "/etc/tuic/fullchain.pem",
        "private_key": "/etc/tuic/private.key",
        "ip": "0.0.0.0",
        "congestion_controller": "bbr",
        "alpn": ["h2"]
    }
    EOF
    
    cat << EOF > /etc/tuic/docker-compose.yaml
    version: "3"
    services:
      tuic:
        image: monkeyray/tuic:0.8.5
        restart: always
        container_name: tuic
        network_mode: host
        volumes:
          - ./config.json:/etc/tuic/config.json:ro
          - ./chenshi.de.pem:/etc/tuic/fullchain.pem:ro
          - ./chenshi.de.key:/etc/tuic/private.key:ro
    EOF
    
  2. start service

    cd /etc/tuic/
    docker-compose up -d
    
  3. references: